Skip to content

feat(Analysis/Complex): residue theorem for rectangular contours#39232

Draft
jerwaynejones wants to merge 1 commit into
leanprover-community:masterfrom
jerwaynejones:add-rectangle-residue
Draft

feat(Analysis/Complex): residue theorem for rectangular contours#39232
jerwaynejones wants to merge 1 commit into
leanprover-community:masterfrom
jerwaynejones:add-rectangle-residue

Conversation

@jerwaynejones
Copy link
Copy Markdown

Adds Mathlib/Analysis/Complex/RectangleResidue.lean (644 LoC), filling the gap between Cauchy–Goursat for rectangles (Complex.integral_boundary_rect_eq_zero_of_differentiable_on_off_countable) and the Cauchy integral formula for circles. The file proves the residue formula for rectangular boundary integrals together with a rotated principal log branch needed to evaluate the left-edge integral that crosses the standard cut.

Why

Mathlib has Cauchy–Goursat for rectangles and the Cauchy integral formula for circles, but no residue theorem for rectangular contours. This file fills that gap. It was extracted from a downstream Lean 4 formalization project (a conditional proof of Goldbach's conjecture, where contour shifting on rectangles arises naturally in Perron's formula).

Main results

  • Complex.hasDerivAt_log_neg — the rotated logarithm log_neg z := log (-z) + I * π has derivative z⁻¹ on the rotated slit plane {z | -z ∈ slitPlane} (cut on the positive real axis).
  • Complex.boundaryIntegral_inv_sub_eq_two_pi_I — for ρ strictly inside the rectangle [z, w], ∮_{∂[z,w]} (s − ρ)⁻¹ ds = 2πi.
  • Complex.boundaryIntegral_eq_residue_sum — parametric residue theorem for a sum of simple poles plus a holomorphic remainder, packaged as Complex.RectangleResidueData.
  • Complex.boundaryIntegral_single_pole — the one-pole specialization.

Structure

The development proceeds in five stages:

  1. A notation Complex.boundaryIntegral for the oriented boundary integral over [z, w], with a Cauchy–Goursat wrapper and additivity/scaling lemmas.
  2. A rotated principal logarithm Complex.log_neg z := log (-z) + I * π with cut on the positive real axis, plus its derivative and corner-comparison identities with the standard Complex.log.
  3. Explicit FTC-based evaluations of the four edge integrals of (s − ρ)⁻¹.
  4. A closed-form residue boundary integral ∮_{∂[z,w]} (s − ρ)⁻¹ ds = 2πi for ρ strictly inside the rectangle.
  5. A parametric residue theorem for sums of simple poles plus a holomorphic remainder, packaged as Complex.RectangleResidueData.

References

  • L. Ahlfors, Complex Analysis (3rd ed.), §4.5.
  • E. Stein and R. Shakarchi, Complex Analysis, Ch. 2 §3 Thm 3.1.

Status

Draft while CI verifies the build against current master — the file was developed against v4.28.0 and cherry-picked forward 2942 commits, so import surface changes are possible. Once CI is green I will flip to ready-for-review.

🤖 Generated with Claude Code

Adds `Mathlib/Analysis/Complex/RectangleResidue.lean` (644 LoC), filling
the gap between Cauchy–Goursat for rectangles
(`Complex.integral_boundary_rect_eq_zero_of_differentiable_on_off_countable`)
and the Cauchy integral formula for circles. The file proves the
residue formula for rectangular boundary integrals together with a
rotated principal log branch needed to evaluate the left-edge integral
that crosses the standard cut.

Main results:

* `Complex.hasDerivAt_log_neg`: the rotated logarithm
  `log_neg z := log (-z) + I*π` has derivative `z⁻¹` on the rotated slit
  plane `{z | -z ∈ slitPlane}` (cut on the positive real axis).
* `Complex.boundaryIntegral_inv_sub_eq_two_pi_I`: for `ρ` strictly inside
  the rectangle `[z, w]`, `∮_{∂[z,w]} (s − ρ)⁻¹ ds = 2πi`.
* `Complex.boundaryIntegral_eq_residue_sum`: a parametric residue theorem
  for a sum of simple poles plus a holomorphic remainder, packaged as
  `Complex.RectangleResidueData`.
* `Complex.boundaryIntegral_single_pole`: the one-pole specialization.

References: Ahlfors §4.5; Stein–Shakarchi Ch. 2 §3 Thm 3.1.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added the new-contributor This PR was made by a contributor with at most 5 merged PRs. Welcome to the community! label May 12, 2026
@github-actions
Copy link
Copy Markdown

Welcome new contributor!

Thank you for contributing to Mathlib! If you haven't done so already, please review our contribution guidelines, as well as the style guide and naming conventions. In particular, we kindly remind contributors that we have guidelines regarding the use of AI when making pull requests.

We use a review queue to manage reviews. If your PR does not appear there, it is probably because it is not successfully building (i.e., it doesn't have a green checkmark), has the awaiting-author tag, or another reason described in the Lifecycle of a PR. The review dashboard has a dedicated webpage which shows whether your PR is on the review queue, and (if not), why.

If you haven't already done so, please come to https://leanprover.zulipchat.com/, introduce yourself, and mention your new PR.

Thank you again for joining our community.

@github-actions github-actions Bot added the t-analysis Analysis (normed *, calculus) label May 12, 2026
@github-actions
Copy link
Copy Markdown

PR summary 1b6d405437

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference
Mathlib.Analysis.Complex.RectangleResidue (new file) 2515

Declarations diff

+ RectangleResidueData
+ RectangleResidueData.toIntegrand
+ bottomEdge_integral_eq
+ boundaryIntegral
+ boundaryIntegral_add
+ boundaryIntegral_const_mul
+ boundaryIntegral_eq_residue_sum
+ boundaryIntegral_eq_zero_of_diffOn
+ boundaryIntegral_finset_sum
+ boundaryIntegral_inv_sub_assemble
+ boundaryIntegral_inv_sub_eq_two_pi_I
+ boundaryIntegral_single_pole
+ hasDerivAt_clog_neg_real
+ hasDerivAt_log_neg
+ horizEdge_integral_eq
+ intervalIntegrable_finset_sum
+ leftEdge_integral_eq
+ log_neg
+ log_neg_eq_log_add_two_pi_I_of_im_neg
+ log_neg_eq_log_of_im_pos
+ neg_left_edge_in_slitPlane
+ rightEdge_integral_eq
+ slitPlane_bottom_edge
+ slitPlane_right_edge
+ slitPlane_top_edge
+ topEdge_integral_eq

You can run this locally as follows
## from your `mathlib4` directory:
git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci

## summary with just the declaration names:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh <optional_commit>

## more verbose report:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh long <optional_commit>

The doc-module for scripts/pr_summary/declarations_diff.sh in the mathlib-ci repository contains some details about this script.


No changes to strong technical debt.
No changes to weak technical debt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new-contributor This PR was made by a contributor with at most 5 merged PRs. Welcome to the community! t-analysis Analysis (normed *, calculus)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant